import sys
import threading
import time


class main_func_thread (threading.Thread):
    def __init__(self, ui):
        threading.Thread.__init__(self)
        self.ui = ui
        
    def handleSerStateChange(self):
        """
        检测打开、关闭串口的按钮状态
        """
        if self.ui.ser_state_flag == 1:
            print("open")
        elif self.ui.ser_state_flag == -1:
            print("close")

    def run(self):
        while True:
            # print(self.ui.open_ser_flag)
            self.handleSerStateChange()
            time.sleep(0.1)

